var each = function (arr , callback) {
    for (let i = 0; i < arr.length; i++) {
        // callback.apply(arr[i],[i,arr[i]])
        callback.call(arr[i],i,arr[i])
    }
}

each([1,2,3],function (i,res) {
    console.log(i,res);
})